﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IceCS.Utility
{
    public enum CacheLoseStrategy
    {
        /// <summary>
        /// 
        /// </summary>
        Time=1,
        /// <summary>
        /// 
        /// </summary>
        CallCount,
        /// <summary>
        /// 
        /// </summary>
        Random,
        /// <summary>
        /// 
        /// </summary>
        Other
    }
    public class IceCache
    {
        public class IceCacheItem
        {
            /// <summary>
            /// 
            /// </summary>
            public int Id { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public DateTime UpdateTime { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int CallCount { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public object Data { get; set; }
        }
        /// <summary>
        /// 缓存大小
        /// </summary>
        public int CacheSize { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public CacheLoseStrategy CacheLoseStrategy { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public Dictionary<string, IceCacheItem> CachePool { get; set; }
        public IceCache()
        {
            CacheSize = 10;
            CachePool = new Dictionary<string, IceCacheItem>(CacheSize);
        }
    }
}
